Micron Document
🎖️GitЯра🎖️


Displaying Raw • Download

baselineprofile/src/main/kotlin/org/meshtastic/baselineprofile/StartupBenchmark.kt bbef7670a13ecb0bbdd88f6a0ca886fc4bdb0e9a (bbef7670) Text, 2.61 KB

T8b949e/*
* Copyright (c) 2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Tff7b72package T7ee787org.meshtastic.baselineprofile

Tff7b72import T7ee787androidx.benchmark.macro.BaselineProfileMode
Tff7b72import T7ee787androidx.benchmark.macro.CompilationMode
Tff7b72import T7ee787androidx.benchmark.macro.StartupMode
Tff7b72import T7ee787androidx.benchmark.macro.StartupTimingMetric
Tff7b72import T7ee787androidx.benchmark.macro.junit4.MacrobenchmarkRule
Tff7b72import T7ee787androidx.test.ext.junit.runners.AndroidJUnit4
Tff7b72import T7ee787androidx.test.filters.LargeTest
Tff7b72import T7ee787androidx.test.platform.app.InstrumentationRegistry
Tff7b72import T7ee787org.junit.Rule
Tff7b72import T7ee787org.junit.Test
Tff7b72import T7ee787org.junit.runner.RunWith

T8b949e/**
* Measures cold-start time with and without the Baseline Profile so the win is quantifiable.
*
* Run it with:
* ```
* ./gradlew :androidApp:benchmarkGoogleReleaseBaselineProfile
* ```
*
* Compare `startupCompilationNone` vs `startupCompilationBaselineProfiles` in the output: the delta
* is the startup improvement the shipped profile buys. `Partial(Require)` fails loudly if the
* profile is missing, so this also guards against a release that silently dropped it.
*/
Tf0883e@LargeTest
Tf0883e@RunWithTb4b4b4(Te6edf3AndroidJUnit4Tff7b72::Te6edf3classTb4b4b4)
Tff7b72class T56d364StartupBenchmark Tb4b4b4{

Tf0883e@getTb4b4b4:Te6edf3Rule Tff7b72val Te6edf3benchmarkRule Tff7b72= Te6edf3MacrobenchmarkRuleTb4b4b4(Tb4b4b4)

Tf0883e@Test Tff7b72fun Td2a8ffstartupCompilationNoneTb4b4b4(Tb4b4b4) Tff7b72= Te6edf3startupTb4b4b4(Te6edf3CompilationModeTb4b4b4.Te6edf3NoneTb4b4b4(Tb4b4b4)Tb4b4b4)

Tf0883e@Test
Tff7b72fun Td2a8ffstartupCompilationBaselineProfilesTb4b4b4(Tb4b4b4) Tff7b72=
Te6edf3startupTb4b4b4(Te6edf3CompilationModeTb4b4b4.Te6edf3PartialTb4b4b4(Te6edf3baselineProfileMode Tff7b72= Te6edf3BaselineProfileModeTb4b4b4.Te6edf3RequireTb4b4b4)Tb4b4b4)

Tff7b72private Tff7b72fun Td2a8ffstartupTb4b4b4(Te6edf3compilationModeTb4b4b4: Te6edf3CompilationModeTb4b4b4) Tff7b72=
Te6edf3benchmarkRuleTb4b4b4.Te6edf3measureRepeatedTb4b4b4(
Te6edf3packageName Tff7b72= Te6edf3InstrumentationRegistryTb4b4b4.Te6edf3getArgumentsTb4b4b4(Tb4b4b4)Tb4b4b4.Te6edf3getStringTb4b4b4(Ta5d6ff"Ta5d6fftargetAppIdTa5d6ff"Tb4b4b4) Tff7b72?: Te6edf3DEFAULT_APP_IDTb4b4b4,
Te6edf3metrics Tff7b72= Te6edf3listOfTb4b4b4(Te6edf3StartupTimingMetricTb4b4b4(Tb4b4b4)Tb4b4b4)Tb4b4b4,
Te6edf3compilationMode Tff7b72= Te6edf3compilationModeTb4b4b4,
Te6edf3startupMode Tff7b72= Te6edf3StartupModeTb4b4b4.Te6edf3COLDTb4b4b4,
Te6edf3iterations Tff7b72= T79c0ff1T79c0ff0Tb4b4b4,
Tb4b4b4) Tb4b4b4{
Te6edf3pressHomeTb4b4b4(Tb4b4b4)
Te6edf3startActivityAndWaitTb4b4b4(Tb4b4b4)
Tb4b4b4}

Tff7b72private Tff7b72companion Tff7b72object Tb4b4b4{
Tff7b72const Tff7b72val Te6edf3DEFAULT_APP_ID Tff7b72= Ta5d6ff"Ta5d6ffcom.geeksville.meshTa5d6ff"
Tb4b4b4}
Tb4b4b4}

Served by rngit 1.5.0 - Generated in 0.06s